<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" isELIgnored="false" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ include file="/include/header.jsp"%>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><s:i18n name="menus"><s:text name="advanceSales"></s:text></s:i18n></title>

	<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/datePicker/WdatePicker.js"></script>

	<script type="text/javascript" src="<%=request.getContextPath() %>/FusionCharts/FusionCharts.js"></script>
	<link href="<%=request.getContextPath() %>/fare/css/base.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="<%=request.getContextPath()%>/jsFile/common.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath()%>/jsFile/multiblepicker.js"></script>
	
 	<link href='<%=request.getContextPath()%>/fare/js/cityquery/cityquery.css' rel="stylesheet" type="text/css" />
	<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/citylist.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/querycity.js'></script>
	<link rev="stylesheet" media="all" href="<%=request.getContextPath() %>/fare/css/form_style.css" type="text/css" rel="stylesheet">
	<!-- 圆角文本框 -->
	<link href="<%=request.getContextPath() %>/fare/css/htc/htc.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="<%=request.getContextPath() %>/jsFile/wait/js/wait.js"></script>	
	
	
	<script type="text/javascript">
	    var flag = "line";//表示选择的是航线，航班还是舱位等级。航线是line,航班是flight,舱位等级是cabin 
	    var rowCounter = 1;
	    var rowSize=1;
		$(function(){
			$('#depCity').querycity({'data':citysFlight,'tabs':labelFromcity,changeDoFusion: changeEvent});
			$('#arrCity').querycity({'data':citysFlight,'tabs':labelFromcity,changeDoFusion: changeEvent});
			//$('#depCity').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList,'changeDoFusion':function(){}});
			//$('#arrCity').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList,'changeDoFusion':function(){}});
			$("#depCity").css({color:'black'});
			$("#arrCity").css({color:'black'});
			$('#flightStartDate').val(generateTimeByFutrueDay(0));
			$('#flightEndDate').val(generateTimeByFutrueDay(29));
			
			
			$("#futureDay").click(function(){//未来天数被点击
				$('#flightStartDate').val("");
				$('#flightEndDate').val("");
				$("input[name='flightDateRadio'][type='radio'][value='2']").attr('checked',true);
			});
			$("#flightStartDate").click(function(){//出发/到达城市被点击
				$("input[name='flightDateRadio'][type='radio'][value='1']").attr('checked',true);
				$("#futureDay").val("");
				if($(this).val()=="" && $("#flightEndDate").val()=="" ){
					$('#flightStartDate').val(generateTimeByFutrueDay(0));
					$('#flightEndDate').val(generateTimeByFutrueDay(30));
				}
			});
			$("#flightEndDate").click(function(){//出发/到达城市被点击
				$("input[name='flightDateRadio'][type='radio'][value='1']").attr('checked',true);
				$("#futureDay").val("");
				if($(this).val()=="" && $("#flightStartDate").val()==""){
					$('#flightStartDate').val(generateTimeByFutrueDay(0));
					$('#flightEndDate').val(generateTimeByFutrueDay(30));
				}
			});
			
			
			$("input[name='flightDateRadio'][type='radio']").change(function(){
				if($(this).val()==1){
					$("#futureDay").val("");
					$('#flightStartDate').val(generateTimeByFutrueDay(0));
					$('#flightEndDate').val(generateTimeByFutrueDay(30));
				}else{
					$('#flightStartDate').val("");
					$('#flightEndDate').val("");
				}
			});
			
			$("input[name='periodsRadio'][type='radio']").change(function(){
				if($(this).val()==1){
					$("input[name='periods'][type='checkbox']").each(function(){
						$(this).attr('checked',true);
					});
					$("#selfStartPeriods").val("");
					$("#selfEndPeriods").val("");
				}else{
					$("input[name='periods'][type='checkbox']").each(function(){
						$(this).attr('checked',false);
					});
				}
			});
			$("input[name='periods'][type='checkbox']").each(function(){
				$(this).click(function(){
					$("input[name='periodsRadio'][type='radio'][value='1']").attr("checked",true);
					$("#selfStartPeriods").val("");
					$("#selfEndPeriods").val("");
				});
			});
			
			$("#selfStartPeriods").click(function(){
				$("input[name='periodsRadio'][type='radio'][value='2']").attr("checked",true);
				$("input[name='periods'][type='checkbox']").each(function(){
						$(this).attr('checked',false);
					});
			});
			$("#selfEndPeriods").click(function(){
				$("input[name='periodsRadio'][type='radio'][value='2']").attr("checked",true);
				$("input[name='periods'][type='checkbox']").each(function(){
						$(this).attr('checked',false);
					});
			});
		});
		function changeEvent(){
			 var tocity = $("#depCity").val();
			 var fromcity = $("#arrCity").val();
			 /* var fromCityCode = $("#depCityCode").val();
			 var toCityCode = $("#arrCityCode").val(); */
			 if((fromcity =='' && tocity !='')||(tocity=='<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>'&& fromcity=='<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>')){
				 alert("<s:i18n name='forms'><s:text name='forms.chooseRoutes'></s:text></s:i18n>");
				 $("#fromCity").focus();
				 return false;
			 }else if(fromcity == tocity){
				 alert("<s:i18n name='forms'><s:text name='forms.sameCity'></s:text></s:i18n>");
				 $("#fromCity").focus();
				 return false;
			 }else if((fromcity !='' && tocity== '')||fromcity !='' && tocity== '<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>'){
				 return false;
			 }else{
				resetRows();
				 
			 }

			
		}
		function checkForm(){
			 if($("#arrCityCode").val()==null || $("#arrCityCode").val()=='<s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n>'){
				 alert("<s:i18n name='forms'><s:text name='forms.notFromCity'></s:text></s:i18n>");
				 return false;
			 }
			 if($("#depCityCode").val() ==null || $("#depCityCode").val() == '<s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n>'){
				 alert("<s:i18n name='forms'><s:text name='forms.notToCity'></s:text></s:i18n>");
				 return false;
				 
			 }
			 if($("#arrCityCode").val()==$("#depCityCode").val()){
				 alert("<s:i18n name="forms"><s:text name="forms.sameCity"></s:text></s:i18n>");
				 return false;
			 }
			 
			 return true;
		 }
		function resetRows(){
			//
			//删除行
			for(var i = 1;i<rowCounter;i++){
				$("tr").remove("#line_flight_cabin_"+i);
			}
			rowSize=1;
			rowCounter = 1;
			$('#airCompany_0')[0].selectedIndex = 0;
			$('#flightnos_0')[0].selectedIndex = 0;
			$('#cabins_0')[0].selectedIndex = 0;
			$("#line_flight_cabin").find("#addRowButtons_0").show();
			
			
			///addRow('line_flight_cabin');
		}
		//查询的验证
		function queryValidate(){
			
			if(validateFlightCity()==true 
					&& validateFlightDate()==true && validateCompareCompany()==true && validatePeriods()==true){
				ajaxLoad();
			}
		}
		//验证航班
		function validateFlightCity(){
			var depCity =$('#depCity').val();
		    var arrCity =$('#arrCity').val();
		    if(depCity==''||depCity=='<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>' || arrCity==''||arrCity=='<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>'){
				    alert("<s:i18n name='forms'><s:text name='forms.chooseRoutes'></s:text></s:i18n>");
			        return false;	     
			}
		    if(depCity == arrCity){
		    	alert("<s:i18n name='forms'><s:text name='forms.sameCity'></s:text></s:i18n>");
		    	return false;
		    }
		    return true;
		}
		//验证航班日期
		function validateFlightDate(){
			var value=$("input[name='flightDateRadio'][type='radio']:checked").val();
			if(value=='1'){
				var startdate = $('#flightStartDate').val();
				var enddate = $('#flightEndDate').val();
				
				if(startdate=="" || enddate==""){
					alert("<s:i18n name='forms'><s:text name='forms.notFlightDate'></s:text></s:i18n>");
					return false;
				}	
				
				var s_date = new Date(startdate.replace(/-/g,"/"));
			    var e_date = new Date(enddate.replace(/-/g,"/"));
			    var time1 = s_date.getTime();
				var time2 = e_date.getTime();
				if(time1>time2){
					alert("<s:i18n name='forms'><s:text name='forms.startBeforeEnd'></s:text></s:i18n>");
					return false;
				}
			}else if(value=='2'){//未来天数
				var futureDays =$('#futureDay').val();
				if(futureDays==""){
					alert("您选择的是按【未来天数】查询，请输入未来天数");
					return false;
				}
				if(futureDays > 30){
					alert("请输入不多于未来30天(包含本日)的天数");
					return false;
				}
			}else{
				return false;
			}
			return true;
		}
		//验证时间段
		function validatePeriods(){
			var value=$("input[name='periodsRadio'][type='radio']:checked").val();
			if(value==1){//选择定义好的时间
				
				var isCheck=false;
				 $("input[name='periods']").each(function() {
					if($(this).attr("checked")=='checked' || $(this).attr("checked")==true || $(this).attr("checked")=='true'){
						isCheck=true;
					}
				 });
				 if(!isCheck){
					 alert("<s:i18n name='forms'><s:text name='forms.chooseOne'></s:text></s:i18n>");
						return false;
				 }
				
			}else{
				var start=$("#selfStartPeriods").val();
				var end=$("#selfEndPeriods").val();
				var reg=/^[0-9]|[1-9][0-9]$/;
				if(reg.test(start)==false || reg.test(end)==false){
					alert("请填写正确的时间段");
					return false;
				}
				if(parseInt(start)<0 || parseInt(end)<parseInt(start) ){
					alert("<s:i18n name='forms'><s:text name='forms.startBeforeEnd'></s:text></s:i18n>");
					return false;
				}
				if(parseInt(end)>24){
					alert("不能超过24小时");
					return false;
				}
				
			}
			return true;
		}
		
		//验证要比较的公司
		function validateCompareCompany(){
			/* if($("input[name='comparedCompanyHbaseKeys'][type='checkbox'][checked!='true']").length==
					$("input[name='comparedCompanyHbaseKeys'][type='checkbox']").length){//没选择的数量等于总数量
				alert("请选择要比较的比较公司");
				return false;
			} */
			return true;
		}
		
		function ajaxLoad(){
			//根据选择的不同，访问不同的url
			var url = null;
			
			var companyKey=$("#airCompany_0").val();
			if(null==companyKey || companyKey==''){
				alert("<s:i18n name='forms'><s:text name='forms.chooseAir'></s:text></s:i18n>");
				return;
			}
			$("#inputDepCityCodes").val(document.getElementById('depCity').value);
			$("#inputArrCityCodes").val(document.getElementById('arrCity').value);
			if(flag == "line"){
				url="<%=request.getContextPath() %>"+"/airCompanyTrendLineFlightCabinAction!analyseLine.action";
			}else if(flag == "flight"){
				url="<%=request.getContextPath() %>"+"/airCompanyTrendLineFlightCabinAction!analyseFlight.action";
			}else if(flag == "cabin"){
				url="<%=request.getContextPath() %>"+"/airCompanyTrendLineFlightCabinAction!analyseCabin.action";

			}
			//alert(url);
 			$("#compareCompanyHbaseKey").attr("disabled",false);
			$.ajax({
				url:url,
				data:$("#queryForm").serialize(),
				type : "POST",
				cache : false, 
				async : true,
			    dataType:'json',
			    beforeSend:function(){
			    	FDCWait.show();
			    },
			    success:function(data){
			    	//alert(data);
			    	//alert(data.Total);
			    	var chart = new FusionCharts("<%=request.getContextPath() %>/FusionCharts/MSLine.swf", "chartID", 990, "450");
					chart.setDataXML(data.Xml.xmlString);
					chart.render("chartContainer");
					createForm(data.Rows);
			    },
			    error:function(){ alert("<s:i18n name='forms'><s:text name='forms.contactAdministrator'></s:text></s:i18n>");},
			    complete:function(){ 
			    	$("#compareCompanyHbaseKey").attr("disabled",true);
			    	FDCWait.hide();
			    }
			});
		}
		function createForm(rows){
			//$("#spreadContainer");
			
			//获得标头有多少个航空公司和渠道
			var companyNum = rows[0].contrastList.length+1;
			var nativeCarrier = rows[0].nativeCarrier;
			//有多少天,即表格有多少行
			var totalRowNum = rows.length;
		    var tableStr = '<table width="0" border="0" cellspacing="0" cellpadding="0"	class="form_list" >'
		    	+'<tr class="title">'
			    +'<td style="text-align: center;width: 55px;"><s:i18n name="forms"><s:text name="forms.flightDate"></s:text></s:i18n></td>'
			    +'<td style="text-align: center;width: 55px;">'+nativeCarrier+'</td>';
			
			for(var i=0; i<rows[0].contrastList.length;i++){
				tableStr  +='<td style="text-align: center;width: 55px;">'+rows[0].contrastList[i].carrierName+'</td>';
				tableStr +='<td style="text-align: center;width: 55px;"><s:i18n name="forms"><s:text name="forms.spread"></s:text></s:i18n></td>';
				tableStr +='<td style="text-align: center;width: 55px;"><s:i18n name="forms"><s:text name="forms.spreadAment"></s:text></s:i18n></td>';
			}	
			tableStr += '</tr>';
			//组织数据显示
			tableStr += '<tbody id="table2" >';
			var dataStr = '';
			for(var i=0;i<rows.length;i++){
				dataStr += '<tr>';
				dataStr += '<td class="line" style="text-align: center">' +rows[i].date + '</td>';
				if(rows[i].nativePrice != null && rows[i].nativePrice!='0.0'){
					dataStr += '<td class="line" style="text-align: center">' +rows[i].nativePrice + '</td>';
					for(var j=0;j<rows[i].contrastList.length;j++){
						if(rows[i].contrastList[j].price != null && rows[i].contrastList[j].price != '0.0'){
							dataStr += '<td class="line" style="text-align: center">' +rows[i].contrastList[j].price + '</td>';
							dataStr += '<td class="line" style="text-align: center">' +rows[i].contrastList[j].spreadAmount + '</td>';
							dataStr += '<td class="line" style="text-align: center">' +rows[i].contrastList[j].spread + '</td>';
						}else{
							dataStr += '<td class="line" style="text-align: center">-</td>';
							dataStr += '<td class="line" style="text-align: center">-</td>';
							dataStr += '<td class="line" style="text-align: center">-</td>';
						}
						
					}
				}else{
					dataStr += '<td class="line" style="text-align: center">-</td>';
					for(var j=0;j<rows[i].contrastList.length;j++){
						if(rows[i].contrastList[j].price != null && rows[i].contrastList[j].price != '0.0'){
							dataStr += '<td class="line" style="text-align: center">' +rows[i].contrastList[j].price + '</td>';
						}else{
							dataStr += '<td class="line" style="text-align: center">-</td>';
						}
						
						dataStr += '<td class="line" style="text-align: center">-</td>';
						dataStr += '<td class="line" style="text-align: center">-</td>';
					}
				}
				
			}
			tableStr += dataStr;
			tableStr += '</tbody>';
			tableStr += '</table>';	
			$("#spreadContainer").html(tableStr);
			
		}
		
		
		/**
		 * 生成一个未来天数的日期字符串
		 */
		function generateTimeByFutrueDay(day){
			if(!/^\d+$/.test(day)){day=0;}
			var now=new Date();
			now.setDate(now.getDate()+day);
			var year=now.getFullYear();
			var month=now.getMonth()+1;
			month=month<10?"0"+month:month+"";
			var date=now.getDate();
			date=date<10?"0"+date:date+"";
			return year+"-"+month+"-"+date;
		}
	function extendSwapCity(){
		$(".line_flight_cabin_0").each(function(){
			if($(".line_flight_cabin_0").index(this)>0)
				$(this).remove();
		});
		$("#airCompany_0")[0].selectedIndex=0;
		$("#flightnos_0")[0].length=0;
		$("#flightnos_0").append("<option value=''>--<s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n>--</option>");
		$("#cabins_0")[0].length=0;
		$("#cabins_0").append("<option value=''>--<s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n>--</option>");
	}
		//重置form
	function resetForm(){
		$('#flightStartDate').val(generateTimeByFutrueDay(0));
		$('#flightEndDate').val(generateTimeByFutrueDay(30));
		$("#depCity").val("<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>");
		$("#arrCity").val("<s:i18n name="forms"><s:text name="forms.cnOrPingYing"></s:text></s:i18n>");

		$("input[name='priceType']:first").attr("checked",true);
		$("input[name='periods']").each(function(){
			$(this).attr("checked",true);
		});
		$(".line_flight_cabin_0").each(function(){
			if($(".line_flight_cabin_0").index(this)>0)
				$(this).remove();
		});
		$("#airCompany_0")[0].selectedIndex=0;
		$("#flightnos_0")[0].length=0;
		$("#flightnos_0").append("<option value=''>--<s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n>--</option>");
		$("#cabins_0")[0].length=0;
		$("#cabins_0").append("<option value=''>--<s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n>--</option>");
		enableDepartureTime();
	}
	function changeAir(object){
	flag = "line";
	enableDepartureTime();
	var num = $(object).attr("id").split("_")[1];
	var carrierKey=$(object).val();
	
	if(carrierKey==undefined || carrierKey==""){
		resetFlightAndCabin(num);
		return ;
	}
		//获取航空公司的航线下的航班
		var fromCityCode=$("#depCityCode").val();
		var toCityCode=$("#arrCityCode").val();
		$.ajax({
			url:"<%=request.getContextPath()%>/airCompanyTrendContrastFlightAction!getFlightNo.action",
			data:{
				companyCarrierKey:carrierKey,
				fromCityCode:fromCityCode,
				toCityCode:toCityCode
			},
			type:'post',
			dataType:'json',
			cache : false, 
		    async : false,
		    beforeSend:function(){FDCWait.show();},
		    success:function(data){
		    	displayFlight(data,num);
		    },
		    error:function(){},
		    complete:function(){FDCWait.hide();}
		});
	}
	function resetFlightAndCabin(num){
		$("#cabins"+"_"+num+" option").remove();
		$("#cabins"+"_"+num).append("<option value=''>"+"-- <s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n> --"+"</option>");
		
		$("#flightnos"+"_"+num+" option").remove();
		$("#flightnos"+"_"+num).append("<option value=''>"+"-- <s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n> --"+"</option>");
		
	}
	function changeFlight(object){
		flag = "flight";
		disableDepartureTime();
		if($(object).val()==""){
			enableDepartureTime();
		}
		var num = $(object).attr("id").split("_")[1];
		var carrierKey = $("#airCompany_"+num).val();
		var fromCityCode=$("#depCityCode").val();
		var toCityCode=$("#arrCityCode").val();
		var flightNo = $(object).val();
		if(!changeFlight()) return ;
		if(flightNo == ''){
			queryByLine(object);
		}
		$.ajax({
			url:"<%=request.getContextPath()%>/airCompanyTrendLineFlightCabinAction!getCabinsByConditions.action",
			data:{
				dataSourceHbaseKey:$("#dataSourceHbaseKey").val(),
				fromCityCode:fromCityCode,
				toCityCode:toCityCode,
				flightNo:flightNo,
				carrierKey:carrierKey
			},
			type:'post',
			dataType:'json',
			cache : false, 
		    async : false,
		    beforeSend:function(){FDCWait.show();},
		    success:function(data){
		    	
		    	if(data.Total>0){
		    		displayCabins(data.Total,data.Rows,num);
		    	}
		    },
		    error:function(){},
		    complete:function(){FDCWait.hide();}
		});
	}
	function displayCabins(count,rows,num){
		//清除之前的舱位等级
		$("#cabins"+"_"+num+" option").remove();
		$("#cabins"+"_"+num).append("<option value=''>"+"-- <s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n> --"+"</option>");
		for(var i=0;i<count;i++){
				$("#cabins"+"_"+num).append("<option value='"+rows[i].carrierFlightnoCabin+"'>"+rows[i].cabinType+"</option>");
		}
	}
	function changeCabin(object){
		flag = "cabin";
		disableDepartureTime();
		if($(object).val()==""){
			flag = "flight";
			//enableDepartureTime();
		}
		
	}
	function disableDepartureTime(){
		$("#departureTimeRow").hide();
	}
	function enableDepartureTime(){
		flag = "line";
		$("#departureTimeRow").show();
	}
	//显示航班号
	function displayFlight(data,num){
		//清除之前的航班
		$("#flightnos"+"_"+num+" option").remove();
		$("#flightnos"+"_"+num).append("<option value=''>"+"-- <s:i18n name='forms'><s:text name='forms.select'></s:text></s:i18n> --"+"</option>");
		if(data && data.length>0){
			
			for(var i=0;i<data.length;i++){
				if(isExistFlight(data[i].flightNo)==true){
					$("#flightnos"+"_"+num).append("<option value='"+data[i].flightNo+"'>"+data[i].flightNo+CHECKED_STR+"</option>");
				}else{
					$("#flightnos"+"_"+num).append("<option value='"+data[i].flightNo+"'>"+data[i].flightNo+"</option>");
				}
				
			}
		}
	}
	
	function queryByLine(object){
		flag = 'line';
	}
	
	//是否存在航班号
	function isExistFlight(f){
		/* var str=CHENKED_FLIGHTS.join("|");
		return str.indexOf(f)==-1?false:true; */
		return false;
	}
	
	//在航空公司，航班，舱位等级那一行后面新增加一行
	function addRow(rowId,object){
		if(rowSize>3){
			alert("<s:i18n name='forms'><s:text name='forms.rowSize'></s:text></s:i18n>");
			return;
		}
		var id =$(object).attr("id").split("_")[1];
		
	 	var trClone;
	 	if(id==0){
	 		trClone=$("#"+rowId).clone();
	 	}else{
	 		trClone= $("#"+rowId+"_"+id).clone();
	 	}
	 	
		var num = rowCounter;
		
		$(trClone).find("#airCompany_"+id).attr("name","comparedCompanyHbaseKeys");
		$(trClone).attr("id",rowId+"_"+num);
		$(trClone).find("#airCompany_"+id).attr("id","airCompany"+"_"+num);
		$(trClone).find("#flightnos_"+id).attr("id","flightnos"+"_"+num);
		$(trClone).find("#cabins_"+id).attr("id","cabins"+"_"+num);
		$(trClone).find("#deleteRowButtons_"+id).attr("id","deleteRowButtons"+"_"+num);
		$(trClone).find("#addRowButtons_"+id).attr("id","addRowButtons"+"_"+num);
		//$("#"+rowId).after($(trClone));
		
		if(id == 0){
			$("#"+rowId).after($(trClone));
		}else{
			$("#line_flight_cabin_"+id).after($(trClone));
			
		}
		rowCounter++; 
		rowSize++;
	}
	
	function deleteRow(object){
		
		var num = $(object).attr("id").split("_")[1];
		if(rowSize==1){
			return;
		}
		if(num == 0){
			$("tr").remove("#line_flight_cabin");
		}else{
			var deleteId = 'line_flight_cabin_'+num;
			$("tr").remove("#"+deleteId);
		}
		rowSize--;
		
	}
	
	
	
	</script>
	
</head>

<body>
<%@ include file="/include/home/home_header.jsp" %>
<jsp:include page="/pages/system/feedback/feedback.jsp" ></jsp:include>
<div class="main main_max">
	<div class="sideBar">
		<div class="box">
			<div class="location"><s:i18n name="forms"><s:text name="forms.position"></s:text></s:i18n>： <s:i18n name="menus"><s:text name="realtime"></s:text></s:i18n> &gt;  
		<s:i18n name="menus"><s:text name="sameChannel"></s:text></s:i18n></div>
		</div>
	</div>
	<div class="cls"></div>
	<div class="content"><div class="form_table_tltle"><s:i18n name="forms"><s:text name="forms.query"></s:text></s:i18n> </div>
		<form id="queryForm"  method="post">
			<input type="hidden" id="inputDepCityCodes" name ="inputDepCityCodes"/>
			<input type="hidden" id="inputArrCityCodes" name ="inputArrCityCodes"/>
			<table id="submitTableId" cellSpacing=0 cellPadding=0 width="100%" border=0 class="form_table">
	 		<%-- <TR>
	   			<TD width="120" height="26" class="left" style="text-align:left">航空公司：</TD>
	            <TD colspan="3">
			    	整个select模版，有抓取的所有航空公司，目前锁定自己所在的航空公司
			      	<select class="easyui-combobox" name="compareCompanyHbaseKey" style="width: 150px;" id="compareCompanyHbaseKey" disabled='true'>
						<c:forEach var="item" items="${crawlCompanys}">
							<option value="${item.hbaseKey}"
							<c:if test="${item.hbaseKey==sessionScope.currentUser.sourceId}">selected='selected' </c:if>
							>${item.name}</option>
						</c:forEach>
					</select>
					<span style="color: #ff0000">*</span>
	   			</TD>
	  		</TR> --%>
	  		<TR>
	    		<TD colspan="1" width="120" height="26" class="left" style="text-align:left"><s:i18n name="forms"><s:text name="forms.trip"></s:text></s:i18n>：</TD>
	   			<TD colspan="1" style="width: 280px;">
	   			<c:if test="${language=='en_US'}">
		   			<jsp:include page="../../inc/flightSelect_en_Us.jsp"></jsp:include>
		   		</c:if>
				 <c:if test="${language=='zh_CN' or language=='other'}">
					<jsp:include page="../../inc/flightSelect.jsp"></jsp:include>
				</c:if>
	     		 <%-- 	<input type="text" name="depCity" style="width:100px" id="depCity" readonly='readonly'/>
			    	<span>至</span>
			        <input type="text" name="arrCity" style="width:100px" id="arrCity" readonly='readonly'/>
	     		    <span style="color: #ff0000">*</span> --%>
	    		</TD>
	    		<td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 140px;"></td><!-- <td colspan="1"></td><td colspan="1"></td> -->
			 </TR>
			 <TR>
				 <TD colspan="1" width="120" height="26" class="left" style="text-align:left"><s:i18n name="forms"><s:text name="forms.dataSources"></s:text></s:i18n>：</TD>
			    <TD colspan="1" align="left">
			     	<select class="easyui-combobox" name="dataSourceHbaseKey" style="width: 150px;" id="dataSourceHbaseKey">
			           <option value="" selected="selected"><s:i18n name="forms"><s:text name="forms.airlinesB2C"></s:text></s:i18n></option>
			           <c:forEach var="item" items="${crawlChannels}">
						 <option value="${item.hbaseKey}">${item.name}</option>
					   </c:forEach>        
					</select>
					<span style="color: #ff0000">*</span>
				</TD>
	    		<td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 140px;"></td><!-- <td colspan="1"></td><td colspan="1"></td> -->
			</TR>
					<TR class = "line_flight_cabin_0" id = "line_flight_cabin">
						<td class="left" colspan="1"><s:i18n name="forms"><s:text name="forms.airlines"></s:text></s:i18n>：</td>
						<td colspan="1" style="width: 400px;"><select name="companyCarrierKey" id="airCompany_0"
							onchange="javascript:changeAir(this);"
							<%-- style="width: 200px; padding: 0px;" --%>>
								<option value="">-- <s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n> --</option>
								<c:forEach var="item" items="${crawlCompanys}">
									<option value="${item.carrierKey}">${item.name}</option>
								</c:forEach>
						</select></td>
						<td class="left"><s:i18n name="forms"><s:text name="forms.flight"></s:text></s:i18n>:</td>
						<td colspan="1"><select  id="flightnos_0"
							name="flightnos"  style=" width: 90px;" onchange="changeFlight(this);"
							<%-- ondblclick="addOrRemoveChioce(this)" --%>>
							<option value="">-- <s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n> --</option>
						</select></td>
						<td class="left"><s:i18n name="forms"><s:text name="forms.classLevel"></s:text></s:i18n>:</td>
						<td colspan="1"><select  id="cabins_0"
							name="carrierFlightnoCabin"  style=" width: 90px;" onchange="changeCabin(this);">
							<option value="">-- <s:i18n name="forms"><s:text name="forms.select"></s:text></s:i18n> --</option>
						</select></td>
						<td colspan="1" >
						<%-- <a id="deleteRowButtons_0" style="cursor:pointer;" onclick="deleteRow(this);"><s:i18n name="forms"><s:text name="forms.delete"></s:text></s:i18n></a>&nbsp;&nbsp;&nbsp;&nbsp;
						<a id="addRowButtons_0" style="cursor:pointer;" onclick="addRow('line_flight_cabin',this);"><s:i18n name="forms"><s:text name="forms.add"></s:text></s:i18n></a></td> --%>
						<a id="deleteRowButtons_0" style="cursor:pointer;" onclick="deleteRow(this);"><img src="${baseURL}/images/del_cli.png"/></a>&nbsp;&nbsp;&nbsp;&nbsp;
						<a id="addRowButtons_0" style="cursor:pointer;" onclick="addRow('line_flight_cabin',this);"><img src="${baseURL}/images/add_cli.png"/></a></td>
					</TR>
					<TR>
						<TD colspan="1" width="120" height="26" class="left" style="text-align:left"><s:i18n name="forms"><s:text name="forms.priceType"></s:text></s:i18n>：</TD>
	          	 	     <TD colspan="1">
	           			     <input name="priceType" value="lowest" type="radio" checked="checked">  <s:i18n name="forms"><s:text name="forms.lowestPrice"></s:text></s:i18n>
	           			     &nbsp;&nbsp;&nbsp;&nbsp;
	               			 <input name="priceType" type="radio" value = "highest">  <s:i18n name="forms"><s:text name="forms.highestPrice"></s:text></s:i18n>
		      			  </TD>
	          	 	    <td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 140px;"></td>
					</TR>														
					<TR>
	            <TD colspan="1" height="26" class="left" style="text-align:left">
	               <div style="display:none;"> <input  name="flightDateRadio" value="1" type="radio" checked="checked" style="dispay:none;"></input> </div>
	               <s:i18n name="forms"><s:text name="forms.flightDate"></s:text></s:i18n>：
	            </TD>
	            <TD colspan="1">
	             	<input name="flightStartDate" type="text" id="flightStartDate" style="width:100px"
				      onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate: '%y-%M-%d',maxDate:'${maxDate}',lang:'<s:i18n name='forms'><s:text name='forms.locale'></s:text></s:i18n>'});">
				    <span>~</span>
				    <input name="flightEndDate" type="text" id="flightEndDate" style="width:100px" 
				      onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd',minDate: '%y-%M-%d',maxDate:'${maxDate}',lang:'<s:i18n name='forms'><s:text name='forms.locale'></s:text></s:i18n>'});">
				    <span style="color: #ff0000">*</span>
		        </TD>
	    		<td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 140px;"></td><!-- <td colspan="1"></td><td colspan="1"></td> -->
	  		</TR>
	  		<TR id="departureTimeRow">
	    		<TD colspan="1" class="left" style="text-align:left">
	    			<div style="display:none;"><input name="periodsRadio" value="1" type="radio" checked="checked" style="dispay:none;"></input>
	    			</div>
	    			<s:i18n name="forms"><s:text name="forms.departureTime"></s:text></s:i18n>：
	    		</TD>
	    		<TD colspan="1">
					<input type="checkbox" name="periods" value="M" checked="checked"/><s:i18n name="forms"><s:text name="forms.morning"></s:text></s:i18n>
					<input type="checkbox" name="periods" value="B" checked="checked"/><s:i18n name="forms"><s:text name="forms.noon"></s:text></s:i18n>
					<input type="checkbox" name="periods" value="A" checked="checked"/><s:i18n name="forms"><s:text name="forms.afternoon"></s:text></s:i18n>
					<input type="checkbox" name="periods" value="N" checked="checked"/><s:i18n name="forms"><s:text name="forms.night"></s:text></s:i18n>
				</TD>
	    		<td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 110px;"></td><td colspan="1" style="width: 140px;"></td><!-- <td colspan="1"></td><td colspan="1"></td> -->
	 		 </TR>
	        <%--  <TR>
	  	         <TD height="26" class="left" style="text-align:left">比较公司：</TD>
		  	     <TD>
					
					<!-- 仅仅作为前台取值的临时隐藏于，后台无影响 -->
					作为比较公司需要去掉自己
					<c:forEach var="item" items="${crawlCompanys}" varStatus="status" >
						<c:if test="${item.hbaseKey!=sessionScope.currentUser.sourceId}">
							<input type="hidden" value="${item.hbaseKey}-${item.name}" tempAttr="temp_contrastCompanys_hidden"/>
						</c:if>
					</c:forEach>
					<table style="margin:10px 0 10px 0;border:0px;" id="temp_table_ken"></table>
					这个js是为了动态的生成比较的航空公司，现在是四个，以后就不知道了，标注一下
					<script type="text/javascript">
						var table=$("#temp_table_ken");
						var rowSize=4;//一行容纳多少个公司，动态的生成表格
						var index=0;
						$("input[type='hidden'][tempAttr='temp_contrastCompanys_hidden']").each(function(){
							index++;
							if(index%rowSize==1){
								table.append("<tr></tr>");
							}
							$("tr:last",table).append("<td style='padding:5px 5px 5px 0px;border-bottom:0px;'>"
							+"<input type='checkbox' name='comparedCompanyHbaseKeys' value='"+this.value.split('-')[0]+"'/>&nbsp&nbsp&nbsp"+this.value.split("-")[1]
							+"</td>");
						});
					</script>
				</TD><TD></TD><TD></TD>
	        </TR> --%>
	  
			
	  
	  		<TR>
			    <TD style="text-align:center;height:35px;" colspan="9">
			         <input type="button" value="" class="<s:i18n name='forms'><s:text name='forms.btn01'></s:text></s:i18n>"  onclick="queryValidate()"/>
			         <input type="button" name="Submit222" value="" class="<s:i18n name='forms'><s:text name='forms.btn02'></s:text></s:i18n>" onclick="resetForm()" />
			    </TD>
	  		</TR>
		</TABLE>
		</form>
		<p></p><p></p>
		
		<div id='chartContainer'></div>
		<div id= 'spreadContainer'></div>
	</div>
</div>
<br></br>  <br></br>  <br></br>  <br></br>  <br></br>
<%@ include file="/include/home/home_footer.jsp" %>  
</body>
</html>

